package com.sds.sweng.swat.miplatform.ui.design.utils;

import java.util.ArrayList;
import java.util.List;

import com.sds.sweng.swat.miplatform.ui.design.models.MiplatformComponent;

public class CloneUtils {

	public static List clone(List src) {
		List cloneList = new ArrayList();

		for (Object element : src) {
			cloneList.add(((MiplatformComponent) element).clone());
		}

		return cloneList;
	}

	public static MiplatformComponent hardClone(MiplatformComponent src) {
		try {
			return ModelUtils.loadModel(ModelUtils.toJsonModel(src));
		} catch (Exception e) {
			return src.clone();
		}
	}

}
